{template '_header'}
<style type="text/css">
    .table_kf {display: none;}
    .table_kf.active {display: table-row-group;}
</style>
<div class="page-header">当前位置：<span class="text-primary">赠品管理</span></div>

<div class="page-content">
    <form action="./index.php" method="get" class="form-horizontal form-search" role="form" >
        <input type='hidden' id='tab' name='type' value="{$_GPC['type']}"/>
        <input type="hidden" name="c" value="site" />
        <input type="hidden" name="a" value="entry" />
        <input type="hidden" name="m" value="mx_shop" />
        <input type="hidden" name="do" value="web" />
        <input type="hidden" name="r"  value="sale.gift" />
        <input type="hidden" name="goodsfrom" value="{$goodsfrom}" />

        <div class="page-toolbar" style="margin-bottom: 0;">
            <span class='col-sm-3'>
                {ifp 'sale.gift.add'}
                <a class='btn btn-primary btn-sm' href="{php echo webUrl('sale/gift/add',array('type'=>$type))}"><i class='fa fa-plus'></i> 添加赠品</a>
                {/if}
            </span>
            <div class="col-sm-6 pull-right">
                <div class="input-group">
                    <input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="赠品名称"> <span class="input-group-btn">
                <button class="btn btn-primary" type="submit"> 搜索</button> </span>
                </div>
            </div>
        </div>

        <ul class="nav nav-arrow-next nav-tabs" id="myTab">
            <li class="{if empty($_GPC['type'])}active{/if}" >
                <a href="{php echo webUrl('sale/gift')}">所有赠品</a>
            </li>
            <li class="{if $_GPC['type']=='ing'}active{/if}" >
                <a href="{php echo webUrl('sale/gift',array('type'=>'ing'))}">进行中</a>
            </li>
            <li class="{if $_GPC['type']=='none'}active{/if}" >
                <a href="{php echo webUrl('sale/gift',array('type'=>'none'))}">未开始</a>
            </li>
            <li class="{if $_GPC['type']=='end'}active{/if}">
                <a href="{php echo webUrl('sale/gift',array('type'=>'end'))}">已结束</a>
            </li>
        </ul>
    </form>
    {if count($gifts)>0}
    <form action="" method="post">
        <div class="page-table-header" style="border: none;">
            <input type='checkbox' />
            <div class="btn-group">
                {ifp 'sale.gift.edit'}
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{php echo webUrl('sale/gift/status',array('status'=>0))}">
                    <i class="icow icow-xiajia3"></i> 下架
                </button>
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('sale/gift/status',array('status'=>1))}">
                    <i class="icow icow-shangjia2"></i> 上架
                </button>
                {/if}
                {ifp 'sale.gift.delete1'}
                <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="如果商品存在购买记录，会无法关联到商品, 确认要彻底删除吗?" data-href="{php echo webUrl('sale/gift/delete1')}">
                    <i class='icow icow-shanchu1'></i> 删除
                </button>
                {/if}
            </div>
        </div>
        <table class="table table-hover table-responsive">
            <thead class="navbar-inner">
            <tr>
                <th style="width:25px;"></th>
                <th style="width:60px;text-align:center;">排序</th>
                <th style="">赠品名称</th>
                <th  style="">&nbsp;</th>
                <th  style="width:60px;" >状态</th>
                <th style="width:65px;text-align: center;">操作</th>
            </tr>
            </thead>
            <tbody class=" table_kf {if $_GPC['type']=='all' || empty($_GPC['type'])}active{/if}" id="tab_all">{template 'sale/gift/list'}</tbody>
            <tbody class=" table_kf {if $_GPC['type']=='ing'}active{/if}" id="tab_ing">{template 'sale/gift/list'}</tbody>
            <tbody class=" table_kf {if $_GPC['type']=='none'}active{/if}" id="tab_none">{template 'sale/gift/list'}</tbody>
            <tbody class=" table_kf {if $_GPC['type']=='end'}active{/if}" id="tab_end">{template 'sale/gift/list'}</tbody>
            <tfoot>
                <tr>
                    <td><input type="checkbox"></td>
                    <td colspan="2">
                        <div class="btn-group">
                            {ifp 'sale.gift.edit'}
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch'  data-href="{php echo webUrl('sale/gift/status',array('status'=>0))}">
                                <i class="icow icow-xiajia3"></i> 下架
                            </button>
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{php echo webUrl('salse/gift/status',array('status'=>1))}">
                                <i class="icow icow-shangjia2"></i> 上架
                            </button>
                            {/if}
                            {ifp 'sale.gift.delete1'}
                            <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="如果商品存在购买记录，会无法关联到商品, 确认要彻底删除吗?" data-href="{php echo webUrl('sale/gift/delete1')}">
                                <i class='icow icow-shanchu1'></i> 删除
                            </button>
                            {/if}
                        </div>
                    </td>
                    <td style="text-align: right" colspan="3">
                        {$pager}
                    </td>
                </tr>
            </tfoot>
        </table>
    </form>
    {else}
    <div class="panel panel-default">
        <div class="panel-body empty-data">暂时没有任何赠品</div>
    </div>
    {/if}
</div>
{template '_footer'}
